package cn.haut.online_read.controller.sanwenzx;

import cn.haut.online_read.crawler.sanwenzx.MajorContentCrawler;
import cn.haut.online_read.crawler.sanwenzx.constant.Constant;
import cn.haut.online_read.utils.CrawlerUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author xing
 * @date 2021-05-22 18:34
 */
@Controller("majorContentController")
@RequestMapping("/sanwenzx")
@Slf4j
public class MajorContentController {


    @GetMapping(value = {"/getContent"})
    @ResponseBody
    public String getMajorContent(
            @RequestParam("url") String url
    ) {
        String crawlerUrl = Constant.BASE_URL + url;
        log.error(crawlerUrl);
        return CrawlerUtils.getJsonResult(new MajorContentCrawler(), crawlerUrl);
    }
}
